﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace OSRun
{
    /// <summary>
    /// 帮助窗体
    /// </summary>
    public partial class HelpForm : Form
    {
        /// <summary>
        /// 软件英文名
        /// </summary>
        private string SoftNameEng { set; get; }

        /// <summary>
        /// 软件中文名
        /// </summary>
        private string SoftNameChina { set; get; }

        /// <summary>
        /// 网页链接
        /// </summary>
        private string WebsiteLink { set; get; }

        /// <summary>
        /// 编译时间
        /// </summary>
        private string ReleaseData { set; get; }

        /// <summary>
        /// 图标
        /// </summary>
        private Image IconLogo { set; get; }

        /// <summary>
        /// 窗体显示
        /// </summary>
        /// <param name="descpList"></param>
        /// <param name="image"></param>
        public static void Show(List<string> descpList, Image image)
        {
            //判断数据是否完备
            if (descpList.Count != 4) return;
            //构造窗体
            var form = new HelpForm(descpList, image);
            //窗体实现
            form.Show();
        }

        /// <summary>
        /// 构造函数
        /// </summary>
        public HelpForm(List<string> descpList, Image image)
        {
            InitializeComponent();
            //获得参数
            this.SoftNameEng = descpList[0];
            this.SoftNameChina = descpList[1];
            this.WebsiteLink = descpList[2];
            this.ReleaseData = descpList[3];
            this.IconLogo = image;
        }

        /// <summary>
        /// 赋予信息
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void HelpForm_Load(object sender, EventArgs e)
        {
            this.SoftNameChinaLabel.Text = this.SoftNameChina;
            this.SoftNameEngLabel.Text = this.SoftNameEng;
            this.ReleaseDateLabel.Text = string.Format("Release Date: {0}", this.ReleaseData);
            this.ICONPictureBox.Image = this.IconLogo;
        }

        /// <summary>
        /// 窗体关闭
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button1_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        /// <summary>
        /// 跳转链接
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void LinK_Button_Click(object sender, EventArgs e)
        {
            System.Diagnostics.Process.Start(this.WebsiteLink);
        }
    }
}
